Test Setup Failed
Pull Request — master (#19)
by Flo
03:33
created

ns.init   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 1
cc 2
nc 2
nop 2
1
(function() {
2
    'use strict';
3
4
    // The namespace
5
    /** @namespace faulancer.core.debugoutput */
6
    var ns = faulancer.namespace('core.debugoutput');
0 ignored issues
show
Bug introduced by
The variable faulancer seems to be never declared. If this is a global, consider adding a /** global: faulancer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Unused Code introduced by
The assignment to variable ns seems to be never used. Consider removing it.
Loading history...
7
8
    var _eventHandler = {
9
10
        onStackClick: function() {
11
12
            document.querySelectorAll('.stack').forEach(function(item) {
13
                item.style.display = 'none';
14
            });
15
16
            document.querySelectorAll('.previousStack').forEach(function(item) {
17
                item.classList.remove('selected');
18
            });
19
20
            this.classList.add('selected');
21
22
            document.getElementById(this.dataset.stackIdentifier).style.display = 'block';
23
24
        }
25
26
    };
27
28
    // Public scope
29
    ns = {
30
31
        init: function() {
32
33
            var stacks = document.querySelectorAll('.previousStack');
34
35
            stacks.forEach(function(item, i) {
36
37
                if (i !== 0) {
38
                    item.classList.remove('selected');
39
                }
40
41
                item.addEventListener('click', _eventHandler.onStackClick);
42
            });
43
44
        }
45
46
    };
47
48
    window.addEventListener('load', ns.init());
49
})();
50